//公共路由
export const constantRouter = [
  {
    path: "/login",
    component: () => import("../views/Login"),
    hidden: true,
  },
  {
    path: "/",
    component: () => import("../layout"),
    name: "index",
    redirect: "/home",
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/Home"),
        meta: {
          title: "首页",
          icon: "el-icon-s-home",
          keepAlive: true,
          requireAuth: true,
        },
      },
    ],
  },
  {
    //404路由
    path: "/404",
    component: ()=>import("../views/404/index.vue"),
    name: "404",
    hidden: true,
  },
];

//权限异步路由
export const asyncRouter = [
  {
    path: "/report",
    name: "Report",
    component: () => import("../layout"),
    redirect: "/report/datasource",
    meta: {
      title: "报表设计",
      icon: "el-icon-s-marketing",
      requireAuth: true,
      permission:
        "datasourceManage|resultsetManage|reportManage|bigScreenManage|excelManage",
    },
    children: [
      {
        path: "/report/datasource",
        name: "datasource",
        component: () => import("../views/Report/datasource/index"),
        meta: {
          title: "数据源",
          icon: "el-icon-tickets",
          keepAlive: true,
          requireAuth: true,
          permission: "datasourceManage",
        },
      },
      {
        path: "/report/resultset",
        name: "resultset",
        component: () => import("../views/Report/resultset/index"),
        meta: {
          title: "数据集",
          icon: "el-icon-document",
          keepAlive: true,
          requireAuth: true,
          permission: "resultsetManage",
        },
      },
      {
        path: "/report/reportIndex",
        name: "reportIndex",
        component: () => import("../views/Report/reportManage/index"),
        meta: {
          title: "报表管理",
          icon: "el-icon-date",
          keepAlive: true,
          requireAuth: true,
          permission: "reportManage",
        },
      },
      {
        path: "/report/bigscreen",
        name: "bigscreen",
        component: () => import("../views/Report/bigScreenReport/index"),
        meta: {
          title: "大屏报表",
          icon: "el-icon-data-analysis",
          keepAlive: true,
          requireAuth: true,
          permission: "bigScreenManage",
        },
      },
      {
        path: "/report/excelreport",
        name: "excelreport",
        component: () => import("../views/Report/excelreport/index"),
        meta: {
          title: "表格报表",
          icon: "el-icon-data-board",
          keepAlive: true,
          requireAuth: true,
          permission: "excelManage",
        },
      },
      {
        path: "/report/reportshare",
        name: "reportshare",
        component: () => import("../views/Report/reportShare/index"),
        meta: {
          title: "报表分享",
          icon: "el-icon-connection",
          keepAlive: true,
          requireAuth: true,
          permission: "reportShareManage",
        },
      },
    ],
  },
  {
    path: '/access',
    name: 'access',
    component: () => import("../layout"),
    redirect: "/access/authority",
    meta: {
      title: '用户权限',
      icon: 'el-icon-user-solid',
      requireAuth: true,
      permission: 'authorityManage|roleManage|userManage'
    },
    children: [
      {
        path: '/access/authority',
        name: 'authority',
        component: () => import('../views/user/accessAuthority/index'),
        meta: {
          title: '权限管理',
          icon: 'el-icon-wallet',
          keepAlive: true,
          requireAuth: true,
          permission: 'authorityManage'
        }
      },
      {
        path: '/access/role',
        name: 'role',
        component: () => import('../views/user/accessRole/index'),
        meta: {
          title: '角色管理',
          icon: 'el-icon-notebook-1',
          keepAlive: true,
          requireAuth: true,
          permission: 'roleManage'
        }
      },
      {
        path: '/access/user',
        name: 'user',
        component: () => import('../views/user/accessUser/index'),
        meta: {
          title: '用户管理',
          icon: 'el-icon-user',
          keepAlive: true,
          requireAuth: true,
          permission: 'userManage'
        }
      },
    ]
  },
];

//任意路由
export const anyRouter = [
  {
    //任意路由到404
    path: "/:pathMatch(.*)*",
    redirect: "/404",
    name: "Any",
    hidden: true,
  },
];
